import math

class CitiZen:
    def __init__(self,X,Y):
        self.X = X
        self.Y = Y

class Position:
    def __init__(self,X,Y,ID):
        self.X = X
        self.Y = Y
        self.ID = ID

def distance(position,citizen):
    position.dist = math.sqrt(pow(position.X-citizen.X,2)+pow(position.Y-citizen.Y,2))

def sortDist(obj):
    return obj.dist

if __name__ == '__main__': 
    n,x,y = input().split()
    citizen = CitiZen(int(x),int(y))
    Lposition = []

    for i in range(int(n)): #获取n个监测点
        x,y = input().split()
        position = Position(int(x),int(y),i)
        Lposition.append(position)
        distance(position,citizen)

    Lposition.sort(key = sortDist)
    for i in Lposition:
        print('({},{})'.format(i.X,i.Y))

